import fetch from '../utils/fetch'
import config from '../utils/config'
import { querystring } from 'vux'

// 消息通知接口
var MessageReceiveService = {
  GetMessageReceive (providerGUID) {
    var data = {
      action: 'GetMessageReceive',
      ProviderGUID: providerGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  SetMessageHistory (msgGUID) {
    var data = {
      action: 'SetMessageHistory',
      MsgGUID: msgGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  GetInviteBidForenoticeGUID (CgPlanGUID, ProviderGUID) {
    var data = {
      action: 'GetInviteBidForenoticeGUID',
      CgPlanGUID: CgPlanGUID,
      ProviderGUID: ProviderGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  GetInviteBidGUID (CgPlanGUID, ProviderGUID) {
    var data = {
      action: 'GetInviteBidGUID',
      CgPlanGUID: CgPlanGUID,
      ProviderGUID: ProviderGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  GetPlanGUIDByInviteBidGUID (InviteBidGUID, ProviderGUID) {
    var data = {
      action: 'GetPlanGUIDByInviteBidGUID',
      InviteBidGUID: InviteBidGUID,
      ProviderGUID: ProviderGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  GetMessageCount (providerGUID) {
    var data = {
      action: 'GetMessageCount',
      ProviderGUID: providerGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  },
  SetMessageHistoryAndGetMessage (providerGUID, msgGUID) {
    var data = {
      action: 'SetMessageHistoryAndGetMessage',
      MsgGUID: msgGUID,
      ProviderGUID: providerGUID
    }
    var url = config.API_SERVER + '/WXApi.ajax?' + querystring.stringify(data)
    return fetch({
      url: url,
      method: 'GET'
    })
  }
}

export default MessageReceiveService
